package cn.dubito.o2o.domian.enmus;

/**
 * @author liliang
 * @description:
 * @date 2018/4/18.
 */
public enum ShopStateEnum {

    /**
     * 枚举状态和说明
     */
    CHECK(0, "审核中"),
    OFFLINE(-1, "店铺关闭"),
    SUCCESS(1, "操作成功"),
    PASS(2, "通过认证"),
    INNER_ERROR(-1001, "系统内部错误"),
    NULL_SHOP_ID(-1002, "shopId 为空"),
    NULL_SHOP(-1003, "商铺为空"),
    ;

    private int state;
    private String stateInfo;

    ShopStateEnum(int state, String stateInfo) {
        this.state = state;
        this.stateInfo = stateInfo;
    }

    /**
     * 返回传入state 对应的枚举
     *
     * @param state
     * @return
     */
    public static ShopStateEnum stateOf(int state) {
        for (ShopStateEnum stateEnum : values()) {
            if (stateEnum.getState() == state) {
                return stateEnum;
            }
        }
        return null;
    }

    public int getState() {
        return state;
    }

    public String getStateInfo() {
        return stateInfo;
    }
}
